//
//  WPVTableViewCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/11.
//  Copyright © 2019 李文强. All rights reserved.
//

#import "WPVTableViewCell.h"

@implementation WPVTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.webView];
        [_webView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@20);
            make.right.equalTo(@0).offset(-20);
            make.top.equalTo(@0);
            make.bottom.equalTo(@0);
        }];
    }
    return self;
}
//- (UILabel *)contentLabel{
//    if (!_contentLabel) {
//        UILabel *label = [[UILabel alloc]init];
//        _contentLabel = label;
//    }
//    return _contentLabel;
//}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
//- (UIImageView *)mainImageView{
//    if (!_mainImageView) {
//        UIImageView *imageView = [[UIImageView alloc]init];
//        imageView.backgroundColor = [UIColor darkGrayColor];
//        _mainImageView = imageView;
//    }
//    return _mainImageView;
//}
- (WKWebView *)webView{
    if (!_webView) {
        WKWebView *web = [[WKWebView alloc]init];
        web.scrollView.scrollEnabled = NO;
        web.backgroundColor = [UIColor whiteColor];
        _webView = web;
    }
    return _webView;
}
- (NSAttributedString *)attributedStringWithHTMLString:(NSString *)htmlString{
    NSDictionary *options = @{ NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute :@(NSUTF8StringEncoding) };
    NSData *data = [htmlString dataUsingEncoding:NSUTF8StringEncoding];
    return [[NSAttributedString alloc] initWithData:data options:options documentAttributes:nil error:nil];
    
}
@end
